home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / os2 / adaptor.zip / ADAPT.ZIP / adaptor / examples / dalib / transp / redistr.f next >
Text File  |  1993-06-15  |  1KB  |  58 lines

  1.       program redisttest
  2.  
  3.       integer I, J, K, M, N
  4.  
  5.       parameter (N=50, M=70)
  6.  
  7.       real A(N,M), SA(N,M), B(N,M)
  8.       logical ERRS(N,M)
  9.  
  10. !hpf$ template T(N,M)
  11. !hpf$ distribute T(*,BLOCK)
  12. !hpf$ align (I,J) with T(I,J) :: A, SA, ERRS
  13. !hpf$ align (J,I) with T(I,J) :: B
  14.  
  15.       integer ERRORS, NUMBER
  16.  
  17.       forall (j=1:M, i=1:N)
  18.         A(i,j) = 100*i + j
  19.       end forall
  20.  
  21.       print *, 'input number of iterations : '
  22.  
  23.       read *, NUMBER
  24.  
  25.       SA = A + NUMBER         ! save values of A
  26.  
  27.       ! transpose A to B
  28.  
  29.       call cm_timer_clear (0)
  30.       call cm_timer_start (0)
  31.  
  32.       do k = 1, NUMBER
  33.          B = A
  34.          B = B + 1
  35.          A = B
  36.       end do
  37.  
  38.       call cm_timer_stop (0)
  39.  
  40.       ! compare against SA
  41.  
  42.       ERRS = (A .ne. SA)
  43.       ERRORS = count (ERRS)
  44.  
  45.       print *, 'Errors = ', ERRORS
  46.  
  47.       if (ERRORS .gt. 0) then
  48.          do i = 1, N
  49.             do j = 1, M
  50.                print *, I, J, A(I,J), SA(I,J), B(J,I)
  51.             end do
  52.          end do
  53.       end if
  54.  
  55.       print *, NUMBER, ' * 2 transpose of size ',N,' x ',M,' needs : '
  56.       call cm_timer_print (0)
  57.       end
  58.